/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.awt.print.Book;
import java.util.*;


/**
 * <p>Project: javase - List1
 * <p>Powered by webrx On 2021-12-08 18:51:15
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class List1 {
    public static void main(String[] args) {
        //Collection c1 = new ArrayList();
        //List c2 = new ArrayList();
        //ArrayList c3 = new ArrayList();

        Object[] objs = new Object[]{1, 2, 3};
        objs[0] = "hello";

        List<Integer> list = new ArrayList<>();
        list.add(6);
        list.add(8);
        list.add(0, 100);
        System.out.println(list.size());
        //list.clear();
        list.add(6);
        list.add(6);
        System.out.printf("%d%n", list.get(1));
        System.out.println(list);
        for (Integer i : list) {
            System.out.println(i);
        }
        System.out.println(list.contains(6));
        System.out.println(list.indexOf(6));
        System.out.println(list.lastIndexOf(6));
        int n = list.remove(0);
        System.out.println(list);
        System.out.println(n);
        //只删除一个6
        //list.remove(Integer.valueOf(6));

        //删除6全部对象
        //list.removeAll(Arrays.asList(Integer.valueOf(6)));

        //删除全部6对象
        while (list.contains(6)) {
            list.remove(Integer.valueOf(6));
        }
        System.out.println(list);


    }
}
